//
//  XXDownFileToFoler.h
//  downFileTest
//
//  Created by 拼凑的断音 on 16/6/23.
//  Copyright © 2016年 拼凑的断音. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef enum : NSUInteger {
    IMG,
    HTML,
} FileToFolerType;

typedef void (^XXDownProgressBlock)(float rate);

typedef void (^XXDownFileCompleteBlock)(BOOL isSuccess);

@interface XMLXXDownFileModel : NSObject

@property (nonatomic,strong) NSString* url;

@property (nonatomic,assign) FileToFolerType type;

@property (nonatomic,strong) NSString* saveName;

@property (nonatomic,assign) long long count;

@property (nonatomic,assign) long long total;

+(XMLXXDownFileModel*)newXXDownFileModelWithUrl:(NSString*)url
                        saveName:(NSString*)name
                        saveType:(FileToFolerType)type;

@end

@interface XXDownFileToFoler : NSObject

/**
 *  通过url下载文件
 *
 *  @param url           url
 *  @param progressBlock 进度block
 *  @param completeBlock 下载完成block
 */
+(void)downFileWithUrlArray:(NSMutableArray<XMLXXDownFileModel*>*)urlArray
     downProgressBlock:(XXDownProgressBlock)progressBlock
         completeBlock:(XXDownFileCompleteBlock)completeBlock;

+(void)stopDownFile;

@end
